<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>

        // 形参本质是局部变量，相当于省略了var 
        // 调用函数传参的过程，相当于给形参赋值

        function rand(min, max) {

            // var min ,max ;
            // min = 1 ;
            // max = 2 ;

            var min , max ;
            console.log(min) ;   // 1
            console.log(max) ;   // 2
            var n = parseInt(Math.random() * (max - min)) + min;
            return n;
        }


        rand(1,2) ;


    </script>

</body>

</html>